//
//  MySQLRow.h
//  LibMySQL
//
//  Created by Marcus Grenängen on 2009-07-24.
//  Copyright 2009 SneWs Soft. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <mysql.h>

#import "MySQLColumn.h"

@interface MySQLRow : NSObject{
	NSArray		 *columnInfo;
	NSArray		 *values;
	NSDictionary *columnMap;
}

//- (id) init;
- (id)initWithData:(NSArray*)columns values:(NSArray*)v map:(NSDictionary*)map;

//- (void) dealloc;

#pragma mark -
#pragma mark Fetch methods
/*
 * @description: Returns the value associated with the specified column name.
 *
 * @returns: A pointer to a valid NS data type such as NSString or NSDate depending
 *			 on the data type the column is specified to have in MySQL.
 */
- (id)getValueByName:(NSString*)columnName;

/*
 * @description: Returns the value associated with the specified column index.
 *
 * @returns: A pointer to a valid NS data type such as NSString or NSDate depending
 *			 on the data type the column is specified to have in MySQL.
 */
- (id)getValueByIndex:(NSInteger)columnIndex;

- (NSInteger)columnIndex:(NSString *)columnName;
- (NSString *)columnName:(NSInteger)columnIndex;

#pragma mark -
#pragma mark Convenience methods such as Images etc...
- (NSInteger)intValueByName:(NSString *)columnName;
- (long)longValueByName:(NSString *)columnName;
- (double)doubleValueByName:(NSString *)columnName;
- (float)floatValueByName:(NSString *)columnName;
- (NSString *)stringValueByName:(NSString *)columnName;
- (NSDate *)dateValueByName:(NSString *)columnName;
- (NSData *)dataValueByName:(NSString *)columnName;
- (NSImage*)imageValueByName:(NSString*)columnName;
- (NSImage*)imageValueByIndex:(NSInteger)columnIndex;

@end